﻿<%namespace name="include" file="/admin/base/include.html" />
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf8" />
<title>无标题文档</title>
${include.jquery()}
${include.bootstrap()}
${include.validationEngine()}
</head>
<body>
<form id="dataform" class="well form-horizontal" method="post" action="${request.url}" enctype="multipart/form-data">
<table width="100%" border="0" cellspacing="0" cellpadding="0">
  <tr>
    <td height="30" background="/static/admin/images/tab/tab_05.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="12" height="30"><img src="/static/admin/images/tab/tab_03.gif" width="12" height="30" /></td>
        <td><table width="100%" border="0" cellspacing="0" cellpadding="0">
          <tr>
            <td width="46%" valign="middle"><table width="100%" border="0" cellspacing="0" cellpadding="0">
              <tr>
                <td width="5%"><div align="center"><img src="/static/admin/images/tab/tb.gif" width="16" height="16" /></div></td>
                <td width="95%" class="STYLE1">
                    <span class="STYLE3">你当前的位置</span>：[${request.params['menu1']}]-[${request.params['menu2']}]-[${id==None and u'新增' or u'编辑'}]
                </td>
              </tr>
            </table></td>
          </tr>
        </table></td>
        <td width="16"><img src="/static/admin/images/tab/tab_07.gif" width="16" height="30" /></td>
      </tr>
    </table></td>
  </tr>
  <tr>
    <td>
        <table width="100%" border="0" cellspacing="0" cellpadding="0">
            <tr>
                <td width="8" background="/static/admin/images/tab/tab_12.gif">&nbsp;</td>
                <td width="370"></td>
                <td width="370"></td>
                <td></td>
                <td width="8" background="/static/admin/images/tab/tab_15.gif">&nbsp;</td>
            </tr>
            <tr>
                <td width="8" background="/static/admin/images/tab/tab_12.gif">&nbsp;</td>
                <td colspan="3">
                    <div class="control-group">
                        <label class="control-label">编号</label>
                        <div class="controls">
                            <input name="orderSN" type="text" id="orderSN" value="${productOrder and productOrder.orderSN or ''}" class="input-medium" readonly/>
                        </div>
                    </div>
                </td>
                <td width="8" background="/static/admin/images/tab/tab_15.gif">&nbsp;</td>
            </tr>
            <tr>
                <td width="8" background="/static/admin/images/tab/tab_12.gif">&nbsp;</td>
                <td>
                    <div class="control-group">
                        <label class="control-label">收件人</label>
                        <div class="controls">
                            <input name="receiverName" type="text" class="input-medium" value="${productOrder and productOrder.receiverName or ''}" readonly/>
                        </div>
                    </div>
                </td>
                <td>
                    <div class="control-group">
                        <label class="control-label" for="name">电话</label>
                        <div class="controls">
                            <input name="contactTel" type="text" class="input-medium" value="${productOrder and productOrder.contactTel or '0'}" readonly/>
                        </div>
                    </div>
                </td>
                <td></td>
                <td width="8" background="/static/admin/images/tab/tab_15.gif">&nbsp;</td>
            </tr>
            <%
            error = ''
            rule = '---'
            sumprice = sum([detail.sellprice*detail.number for detail in productOrder.productOrderDetails])
            if productOrder.couponRandom:
                rule = productOrder.couponRandom.coupon.rule
                minus, total = rule.split('/')
                if int(total)>sumprice:
                    error = "sumprice:" + str(sumprice) + " coupon:" + total
                else:
                    sumprice = sumprice - int(minus)
            %>
            <tr>
                <td width="8" background="/static/admin/images/tab/tab_12.gif">&nbsp;</td>
                <td>
                    <div class="control-group">
                        <label class="control-label" for="name">总计</label>
                        <div class="controls">
                            <input name="sum" type="text" class="input-medium" value="${error or sumprice}" readonly/>
                        </div>
                    </div>
                </td>
                <td>
                    <div class="control-group">
                        <label class="control-label" for="name">优惠券</label>
                        <div class="controls">
                            <input name="contactTel" type="text" class="input-medium" value="${rule}" readonly/>
                        </div>
                    </div>
                </td>
                <td></td>
                <td width="8" background="/static/admin/images/tab/tab_15.gif">&nbsp;</td>
            </tr>
            <tr>
                <td width="8" background="/static/admin/images/tab/tab_12.gif">&nbsp;</td>
                <td colspan="3">
                    <table class="table table-bordered table-striped" style="table-layout:fixed;">
                        <thead class="typ">
                            <tr>
                                <th width="90" style="text-align:center">商品</th>
                                <th width="10" style="text-align:center">数量</th>
                                <th width="15" style="text-align:center">单价</th>
                                <th width="20" style="text-align:center">小计</th>
                            </tr>
                        </thead>
                        <tbody>
                            %for detail in productOrder.productOrderDetails:
                            <tr>
                                <td>
                                    <p>${detail.name}</p>
                                </td>
                                <td style="text-align:center;">
                                    <p>${detail.number}</p>
                                </td>
                                <td style="text-align:center;">
                                    <p class="no-margin">¥${detail.sellprice}</p>
                                </td>
                                <td style="text-align:center;">
                                    <p class="no-margin">¥${detail.number * detail.sellprice}</p>
                                </td>
                            </tr>
                            %endfor
                        </tbody>
                    </table>
                </td>
                <td width="8" background="/static/admin/images/tab/tab_15.gif">&nbsp;</td>
            </tr>
            <tr>
                <td width="8" background="/static/admin/images/tab/tab_12.gif">&nbsp;</td>
                <td colspan="2">
                    <div class="control-group">
                        <label class="control-label" for="name">订单状态</label>
                        <div class="controls">
                            <select name="orderStatus" class="input-medium validate[required]">
                                <option value="">--请选择--</option>
                                %if productOrder:
                                ${h.getoptions('productorderstatus', str(productOrder.orderStatus))|n}
                                %else:
                                ${h.getoptions('productorderstatus')|n}
                                %endif
                            </select>
                        </div>
                    </div>
                </td>
                <td></td>
                <td width="8" background="/static/admin/images/tab/tab_15.gif">&nbsp;</td>
            </tr>
            <tr>
                <td width="8" background="/static/admin/images/tab/tab_12.gif">&nbsp;</td>
                <td colspan="3">
                    <div class="form-actions">
                        %if id:
                        <input type="hidden" name="id" value="${productOrder.id}"/>
                        %endif
                        <input type="hidden" name="form.submitted" value="save"/>
                        <button class="btn btn-primary" type="submit">保存</button>
                        <button class="btn btn-primary" type="reset">重置</button>
                        <button class="btn btn-primary">返回</button>
                    </div>
                </td>
                <td width="8" background="/static/admin/images/tab/tab_15.gif">&nbsp;</td>
            </tr>
        </table>
    </td>
  </tr>
  <tr>
    <td height="35" background="/static/admin/images/tab/tab_19.gif"><table width="100%" border="0" cellspacing="0" cellpadding="0">
      <tr>
        <td width="12" height="35"><img src="/static/admin/images/tab/tab_18.gif" width="12" height="35" /></td>
        <td>
        </td>
        <td width="16"><img src="/static/admin/images/tab/tab_20.gif" width="16" height="35" /></td>
    </tr>
</table>
</td>
  </tr>
</table>
</form>
<script>
$(document).ready(function(){
    $('#dataform').validationEngine();
})
</script>
</body>
</html>
